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