UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XaECm5zb8DWFHqAdW7tKRl3j65x0ArdShW1GoBi49dI='
WHERE
key_id = '1c222888aeea92a7860a59bc8ba7b70ad6a865706a4875cb6f570be5a139f4c1'
AND (
token = 'XaECm5zb8DWFHqAdW7tKRl3j65x0ArdShW1GoBi49dI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)