UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jwodYTURUqy0l6qv0EJQoU5NgEJLUndxQeyIGVSR2+E=' 
WHERE 
  key_id = 'c3f6a91cc3157999a4bb4d2599853f810550ced9b220bafb84b195189e3d5e16' 
  AND (
    token = 'jwodYTURUqy0l6qv0EJQoU5NgEJLUndxQeyIGVSR2+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027