UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bsfueRnCv53M1bDRH2JHihrzejvURIx5IYIxForeQE8=' 
WHERE 
  key_id = '9eee575858dd5c3c8b924297adf56d2cf456751f6f10043f66c3c45d6fd26dd2' 
  AND (
    token = 'bsfueRnCv53M1bDRH2JHihrzejvURIx5IYIxForeQE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023