UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ieUxAtg5wPT4xoynnky0jcchzy05W2pWTnt+gMOaqro=' 
WHERE 
  key_id = '5a3da360fd58da660fb73dfb213c4776415194080323aa552b05c72de1c59d01' 
  AND (
    token = 'ieUxAtg5wPT4xoynnky0jcchzy05W2pWTnt+gMOaqro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021