UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ASgCFAUgmNdwrAVbusYEET3q+gP+9Rb5J+Qu99+GM+Y='
WHERE
key_id = 'c2d4b5ca0a29fd5f5479180d5d1a44d8bcda626e350977a484c87bee7d3d36fc'
AND (
token = 'ASgCFAUgmNdwrAVbusYEET3q+gP+9Rb5J+Qu99+GM+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)