UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BH3BxB3M2XvXXyxKOMeohpacUenr/tGCfpARCl2+2Zw='
WHERE
key_id = 'cad506a59a7c5c36a9084ccbf8b183ce09002a7f8385f1d36f475e4692395e0d'
AND (
token = 'BH3BxB3M2XvXXyxKOMeohpacUenr/tGCfpARCl2+2Zw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)