UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jNpWZI/DNc2ddD+SPvfOuzXk06RU5PNuGzbTTG/MElQ='
WHERE
key_id = 'f78fe3f527e510b257db45f5ccf9972f8336897ec30aca6510d422d97856c584'
AND (
token = 'jNpWZI/DNc2ddD+SPvfOuzXk06RU5PNuGzbTTG/MElQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)