UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KUABqCuDHJ+JTWd9sKlANwBRboLRdpgz93HUaArLHtk='
WHERE
key_id = 'c27388248ead8d11c1388d8ef254120380b4bd93360626646eb7ba08afede846'
AND (
token = 'KUABqCuDHJ+JTWd9sKlANwBRboLRdpgz93HUaArLHtk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)