UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ElidSod/UDs2sqayBzNM/sNXatLjwdU/CN82wH7/uLI=' 
WHERE 
  key_id = 'c9a0fd3c57f2e9807b414d43e9b6f379820ab166a2180f481ac8f2c9d1a01d51' 
  AND (
    token = 'ElidSod/UDs2sqayBzNM/sNXatLjwdU/CN82wH7/uLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030