UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q1ercX+m6mmTnyLJIAU8vh5K20xq/x3UXaTIsyAaqNc='
WHERE
key_id = 'ccae4e3ba48f29a3705e19298b2a64e558a7821987b6267a646ca6d2d08fe598'
AND (
token = 'q1ercX+m6mmTnyLJIAU8vh5K20xq/x3UXaTIsyAaqNc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)