UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wAlYAfXOWgIiradcOF+m0nes385Fydh2iYuCcF8hRXk='
WHERE
key_id = '6597bcb4b7762ed65f8e37dd2af30e6242d67952cbd002da6af8fdea9c168261'
AND (
token = 'wAlYAfXOWgIiradcOF+m0nes385Fydh2iYuCcF8hRXk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)