UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jLEaC8edQpdTnlt131vYf9Wf5SGUr+sPUgogLlqbfSk='
WHERE
key_id = 'd72e0ade8faa8b941f04e9b25fbb10f10e2d2e750d1a4d9c87025f98aea93100'
AND (
token = 'jLEaC8edQpdTnlt131vYf9Wf5SGUr+sPUgogLlqbfSk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)