UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OWEOaEUquFSeoZ+kD8L9lI92Yb93TA2bfWVKYl+9sH8='
WHERE
key_id = '309428464d7c637a1cbbf48077e8a1b534bb7a0eca5963698a642a05764fb8c2'
AND (
token = 'OWEOaEUquFSeoZ+kD8L9lI92Yb93TA2bfWVKYl+9sH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)