UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gOqbcJqPsCHQndOhrYgNd6Qq4e26nEbyvwBxwVezcls='
WHERE
key_id = '85f9e1957689b30e75c222c15db0a81fe7b2f8e58df222b7552d6c99350b0931'
AND (
token = 'gOqbcJqPsCHQndOhrYgNd6Qq4e26nEbyvwBxwVezcls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)