UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JufI2ithd+B8QNq06kZGIe2Snahxt9xRgfDg1+VM04Y='
WHERE
key_id = 'b198b81ff4ae3cf744b327196a29f69258ddda22f6f8f774e8d13d4328fd1f0e'
AND (
token = 'JufI2ithd+B8QNq06kZGIe2Snahxt9xRgfDg1+VM04Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)