UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm+IR9uO69ROa0cwCpGt2q10dt9xflTu9006E1VZQUBc=' 
WHERE 
  key_id = '9452ac63cd2e7e991853942fba15e5122ab5c2183ef400cf38a17581d94c6969' 
  AND (
    token = 'm+IR9uO69ROa0cwCpGt2q10dt9xflTu9006E1VZQUBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026