UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mXb26j+hGL5DbzLXvBtbb+H6zeyge6U03PeiqNUVAak=' 
WHERE 
  key_id = 'de8a03392d2a943443180809bf81e3d2b30c9652f20fd89a3a19492108178e67' 
  AND (
    token = 'mXb26j+hGL5DbzLXvBtbb+H6zeyge6U03PeiqNUVAak=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024