UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9JRNWzM7F0ggO4EF67D/J9A6Y8a0dS+Bx1xOJMTf0Ow='
WHERE
key_id = '403145667f52903ee6133f72b71a61418fae29a091fbb779b88caa2800fe421b'
AND (
token = '9JRNWzM7F0ggO4EF67D/J9A6Y8a0dS+Bx1xOJMTf0Ow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)