UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7VAC8+ZVlJZhERC2de0PO/bPP0+AWChsqZZxOziUMwo=' 
WHERE 
  key_id = '51f2960a2ce4ca4a9e59a90c10e30000c0b0adac9427a5c869a20f1cefd0b037' 
  AND (
    token = '7VAC8+ZVlJZhERC2de0PO/bPP0+AWChsqZZxOziUMwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038