UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z6RfATr+/MnzYF3TZpWAK6Ra8Ud0tOSggh+Juky5GZ0='
WHERE
key_id = '86a601675854976ed55e007bd7ffe6abbc7fd7787fb0027f4cc01813ed63417c'
AND (
token = 'Z6RfATr+/MnzYF3TZpWAK6Ra8Ud0tOSggh+Juky5GZ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)