UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p6O6wIGfLTKojt4BgIuPn0d1evtqZV2cM1UJiesFW4I=' 
WHERE 
  key_id = '23d1851b97de3d8a03a131b492b36fe631f58d8a7f6fb7117e9690a6b4dbc0d3' 
  AND (
    token = 'p6O6wIGfLTKojt4BgIuPn0d1evtqZV2cM1UJiesFW4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026