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