UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Vih/euOm5ZX+dfgGcHtxafS2lfJMb3cpkE++lzfvz8='
WHERE
key_id = 'd761a50e426816b2ae3a015e989523ee593245bdabe31f2b80593a9096a68b6f'
AND (
token = '6Vih/euOm5ZX+dfgGcHtxafS2lfJMb3cpkE++lzfvz8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)