UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IpH3vgnM39u0WRVAXs3Q459Fmos4nFWfKWdfhDRFenM='
WHERE
key_id = '1b0421abbde6f7bac839b8fc0fd65884112cb0465cef6b702ba4b84aa3c523bc'
AND (
token = 'IpH3vgnM39u0WRVAXs3Q459Fmos4nFWfKWdfhDRFenM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)