UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jQAxTZN2QysOzlLoFoN3am9cYrNj6iR7fm0znT8dex4='
WHERE
key_id = '7fad1212d8321d5da6cd210253d0655f3bc4b58a58652e32613052ebdbd5d01b'
AND (
token = 'jQAxTZN2QysOzlLoFoN3am9cYrNj6iR7fm0znT8dex4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)