UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hT7u8XdqA5oYcmxDgzXVRvn2j/mv/YV33458pbpqoRo='
WHERE
key_id = '866d36cd73d76143cf83aaf9c02d68967b516a95e47512ec5539637aa1af1666'
AND (
token = 'hT7u8XdqA5oYcmxDgzXVRvn2j/mv/YV33458pbpqoRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)