UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c1Y0Y0t5GokuaQD2e45TJ8m8TAWe7lbX67lPUQoVgvY='
WHERE
key_id = '389655dfcd01692cf0f20baef5edad0daccdf2871422c35fcdf4ffe86093d045'
AND (
token = 'c1Y0Y0t5GokuaQD2e45TJ8m8TAWe7lbX67lPUQoVgvY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)