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