UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YgV0+4Evi8oqhX45VjMoghVcrw3yXL1Z+2CkksgzRrI='
WHERE
key_id = '7e495654ecc119378a408ac1f014d06ec9e3a840497850fc746dae8a83df8d27'
AND (
token = 'YgV0+4Evi8oqhX45VjMoghVcrw3yXL1Z+2CkksgzRrI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)