UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tpVaVDixHW4ESS+0WQuA+PERShBncP0b8EBXDFBaimA=' 
WHERE 
  key_id = '71a0fdf212e8e8631ae0cb8e902911623e56ef3dc155748e78020608219b98be' 
  AND (
    token = 'tpVaVDixHW4ESS+0WQuA+PERShBncP0b8EBXDFBaimA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077