UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RaQb7vGnDBel8iwQx/BJg2NV4JLOu+70oWfJnZ302iw=' 
WHERE 
  key_id = '1899fde3744fe9643499f99f4daf769f9f0c4a950cb06c1188a38877cd89a28f' 
  AND (
    token = 'RaQb7vGnDBel8iwQx/BJg2NV4JLOu+70oWfJnZ302iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026