UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd4+6M55vVLB0TDLgtSVaj4uoQex+zS1DJ5anwlvQW7c=' 
WHERE 
  key_id = '5578009ec235559c4771c64c123204f865a42e40e58f9c2c06c53dbc1f401499' 
  AND (
    token = 'd4+6M55vVLB0TDLgtSVaj4uoQex+zS1DJ5anwlvQW7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053