UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '55AmD/f6PCQK6R1lNlcvc9zqmj7ez0WvuT/vnn/8kL0='
WHERE
key_id = 'b78dbe007c7124482943e12f12105d11758a7029e5a50d8c9b49876aefe14eee'
AND (
token = '55AmD/f6PCQK6R1lNlcvc9zqmj7ez0WvuT/vnn/8kL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)