UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a8WdiMCIJ8kxa2lJaUPSK3q7CJBv2ZFHWhF3lVviD7o=' 
WHERE 
  key_id = '271ca18b1c81fd8116a1d0ab5ab68e54d863f5aa3dcc2dbcee26836930fb135a' 
  AND (
    token = 'a8WdiMCIJ8kxa2lJaUPSK3q7CJBv2ZFHWhF3lVviD7o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047