UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TdS9PLdwqbqfn2LIpEwGIBrms1UpHThi7Gz/Ut5NrVI='
WHERE
key_id = 'dbc16ddf1891359cc3735fc52a0661345559f31d31d37625b366c083a1bca317'
AND (
token = 'TdS9PLdwqbqfn2LIpEwGIBrms1UpHThi7Gz/Ut5NrVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)