UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lNdW5VBjV1pGfMi9GgbNd7Y6A3qBDKE+tXXOozQfREY='
WHERE
key_id = '48ead023fd47f4f199f699a411722160a617b855403d92b2b3cfa7142c9234aa'
AND (
token = 'lNdW5VBjV1pGfMi9GgbNd7Y6A3qBDKE+tXXOozQfREY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)