UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FD2A0F+rdB8O8NbkNuIKioe/PPF0DiWVR3duX9jX+Sw=' 
WHERE 
  key_id = '27f742b6385300aefb4ec3846550878754e2837a1877436fc29e1ddb6bbd43ca' 
  AND (
    token = 'FD2A0F+rdB8O8NbkNuIKioe/PPF0DiWVR3duX9jX+Sw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035