UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b+dEzJr2S3jWw0Wuv1StSMow5CJbTuyU3wLPbjGmwWw=' 
WHERE 
  key_id = 'a7e1494264622e8f24006696dc848d866365234519ded4b7b24a46092caf0054' 
  AND (
    token = 'b+dEzJr2S3jWw0Wuv1StSMow5CJbTuyU3wLPbjGmwWw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031