UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KQeN6wUQ3PtHSyCoLZW3l+GenjvCV/q4SKZ1MFIknNk='
WHERE
key_id = 'beda2258341946a9eed511a8cd495555da94be36c94214d596ebb185933ee9ed'
AND (
token = 'KQeN6wUQ3PtHSyCoLZW3l+GenjvCV/q4SKZ1MFIknNk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)