UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YNtuXriKU+bWsqlRGN0dJWGxKKfGD2NN8NqAF+oW0Qc='
WHERE
key_id = '351509e790b998727c7c33a5a6254b0aad55f9bbbacb4d7f44e0f4ff52defe0e'
AND (
token = 'YNtuXriKU+bWsqlRGN0dJWGxKKfGD2NN8NqAF+oW0Qc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)