UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I9Ba1x0uDe2g0M9GU9hnlfU94m87R3BkEOKYLdvyMb0='
WHERE
key_id = 'f33935457153c70fbb1974c454db2407e85ab2e1e5c8bb5e991cd2644982e334'
AND (
token = 'I9Ba1x0uDe2g0M9GU9hnlfU94m87R3BkEOKYLdvyMb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)