UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JCsQKct7RzMUswUaOTqQxKdiNq/degJvBKH+sGBJ9jE='
WHERE
key_id = 'a47f33a2d06cdcf5ccbc7412b3b22ca3a9cf531faafb2ac00f3e500e257556e4'
AND (
token = 'JCsQKct7RzMUswUaOTqQxKdiNq/degJvBKH+sGBJ9jE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)