UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ivDp+bqxadzFqRnRK3/xjhVf0Vdbo99Ozjt8wQawcRA=' 
WHERE 
  key_id = '8f8f63be2fbfa93bcca46500d97c65a688e824f90a5c246b6c901bdff414493d' 
  AND (
    token = 'ivDp+bqxadzFqRnRK3/xjhVf0Vdbo99Ozjt8wQawcRA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024