UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yeiKm6jgZbkNgtJqftOPOucVom/epWl28ofExUikhC0=' 
WHERE 
  key_id = 'cff081df04483c56b46e2d387f2e357259cbd01e7c173e1f3deddde5efeaa8e5' 
  AND (
    token = 'yeiKm6jgZbkNgtJqftOPOucVom/epWl28ofExUikhC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038