UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9z9pXvGG+nNIP8W62q3S7nEczH74gadzXwsN1O10uyA='
WHERE
key_id = 'af7b950e0d3369baf339d7c8f406c3da6ff21166166ea601b273cd388df396d3'
AND (
token = '9z9pXvGG+nNIP8W62q3S7nEczH74gadzXwsN1O10uyA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)