UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'txtRxERUorbzX0Q1zPi6uwbORsH2N0u1IPO49YYRcY4='
WHERE
key_id = '6ed471436ea15c1d2660448a066df18005663446986fd852da5e2f82aa874cec'
AND (
token = 'txtRxERUorbzX0Q1zPi6uwbORsH2N0u1IPO49YYRcY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)