UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iXuWZ3GJFUSNVZDYeRLtwZXpof3xkH1cVxRRhae1vmU='
WHERE
key_id = 'c20e09a3ff69d048d1a9fde3c3e1778ddf139012df4cf7cdc039d74faff9c9fc'
AND (
token = 'iXuWZ3GJFUSNVZDYeRLtwZXpof3xkH1cVxRRhae1vmU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)