UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LKeDy+A2jrJbuuaS0q2f8mJCdf/M7eAnRn8Wk+m/r34='
WHERE
key_id = 'c2fa2660f1036564ec4f66d409187f7626cdd8afb39e2dd3a0826a8bca2e33fe'
AND (
token = 'LKeDy+A2jrJbuuaS0q2f8mJCdf/M7eAnRn8Wk+m/r34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)