UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xE6Z2J4DlsGoWA8GpZ6z0x46EfCRoNzUY9qIkYHU4Ow=' 
WHERE 
  key_id = '8c87cf0bdeff30c7e5c72aa07f5426503b411cef08d7e93b8d5e0fc1cc9d130d' 
  AND (
    token = 'xE6Z2J4DlsGoWA8GpZ6z0x46EfCRoNzUY9qIkYHU4Ow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020